﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Game.Foundation.ChineseChess
{
    public class Shi : ChessmanBase
    {
        public Shi(Chessboard board, Camp camp, string text) : base(board, camp, text) { }

        public override bool CanMoveTo(int xLocation, int yLocation)
        {
            if ((xLocation >= 4 && xLocation <= 6) && ((yLocation >= 1 && yLocation <= 3) || (yLocation >= 8 && yLocation <= 10)))
            {
                int xoffset = xLocation - this.XLocation;
                int yoffset = yLocation - this.YLocation;
                if (Math.Abs(xoffset) == 1 && Math.Abs(yoffset) == 1)
                {
                    return true;
                }
            }

            return false;
        }
    }
}
